package com.atgugui.excel;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.atgugui.eduservice.entity.ExcelSubjectData;

import java.util.HashMap;
import java.util.Map;

/**
 * 配置一个Excel读取的监听器，通过这个监听器读取指定的Excel中的数据
 */
@SuppressWarnings("all")
public class ExcelListener extends AnalysisEventListener<ExcelSubjectData> {

    /**
     * 按行读取Excel中的数据
     * @param student
     * @param analysisContext
     */
    @Override
    public void invoke(ExcelSubjectData excelSubjectData, AnalysisContext analysisContext) {
        System.out.println("****-" + excelSubjectData);
    }

    /**
     * 读取表头信息
     * @param headMap
     * @param context
     */
    @Override
    public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
        System.out.println("表头：" + headMap);
    }


    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
        System.out.println("去读结束");
    }
}
